package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * Subscription entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "subscriptions")
@GeneratorKey(tableName = "subscriptions")
public class SubscriptionVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 2515745183635587817L;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "address_id")
	private AddressVO address;

	@Temporal(TemporalType.DATE)
	@Column(name = "address_date_from", length = 10)
	private Date addressDateFrom;

	@Temporal(TemporalType.DATE)
	@Column(name = "address_date_to", length = 10)
	private Date addressDateTo;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id", nullable = false)
	private CustomerVO customer;

	@Temporal(TemporalType.DATE)
	@Column(name = "date_end", nullable = false, length = 10)
	private Date dateEnd;

	@Temporal(TemporalType.DATE)
	@Column(name = "date_start", nullable = false, length = 10)
	private Date dateStart;

	@Column(name = "edition_request", nullable = false)
	private boolean editionRequest;

	@Column(name = "quantity", nullable = false)
	private Integer quantity;

	@Column(name = "stopped", nullable = false)
	private boolean stopped;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "subscription_id")
	private SubscriptionVO subscription;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subscription")
	private List<SubscriptionChangeVO> subscriptionChanges;

	@Column(name = "subscription_date", nullable = false, length = 23)
	private Date subscriptionDate;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "subscription_plan_id", nullable = false)
	private SubscriptionPlanVO subscriptionPlan;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subscription")
	private List<SubscriptionRoadmapVO> subscriptionRoadmaps;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "subscription_service_id", nullable = false)
	private SubscriptionServiceVO subscriptionService;

	/** default constructor */
	public SubscriptionVO() {
		this.subscriptionChanges = new ArrayList<SubscriptionChangeVO>();
		this.subscriptionRoadmaps = new ArrayList<SubscriptionRoadmapVO>();
	}

	/** @return the address */
	public AddressVO getAddress() {
		return this.address;
	}

	/** @return the addressDateFrom */
	public Date getAddressDateFrom() {
		return this.addressDateFrom;
	}

	/** @return the addressDateTo */
	public Date getAddressDateTo() {
		return this.addressDateTo;
	}

	/** @return the customer */
	public CustomerVO getCustomer() {
		return this.customer;
	}

	/** @return the dateEnd */
	public Date getDateEnd() {
		return this.dateEnd;
	}

	/** @return the dateStart */
	public Date getDateStart() {
		return this.dateStart;
	}

	/** @return the quantity */
	public Integer getQuantity() {
		return this.quantity;
	}

	/** @return the subscription */
	public SubscriptionVO getSubscription() {
		return this.subscription;
	}

	/** @return the subscriptionChanges */
	public List<SubscriptionChangeVO> getSubscriptionChanges() {
		return this.subscriptionChanges;
	}

	/** @return the subscriptionDate */
	public Date getSubscriptionDate() {
		return this.subscriptionDate;
	}

	/** @return the subscriptionPlan */
	public SubscriptionPlanVO getSubscriptionPlan() {
		return this.subscriptionPlan;
	}

	/** @return the subscriptionRoadmaps */
	public List<SubscriptionRoadmapVO> getSubscriptionRoadmaps() {
		return this.subscriptionRoadmaps;
	}

	/** @return the subscriptionService */
	public SubscriptionServiceVO getSubscriptionService() {
		return this.subscriptionService;
	}

	/** @return the editionRequest */
	public boolean isEditionRequest() {
		return this.editionRequest;
	}

	/** @return the stopped */
	public boolean isStopped() {
		return this.stopped;
	}

	/** @param address */
	public void setAddress(AddressVO address) {
		this.address = address;
	}

	/** @param addressDateFrom */
	public void setAddressDateFrom(Date addressDateFrom) {
		this.addressDateFrom = addressDateFrom;
	}

	/** @param addressDateTo */
	public void setAddressDateTo(Date addressDateTo) {
		this.addressDateTo = addressDateTo;
	}

	/** @param customer */
	public void setCustomer(CustomerVO customer) {
		this.customer = customer;
	}

	/** @param dateEnd */
	public void setDateEnd(Date dateEnd) {
		this.dateEnd = dateEnd;
	}

	/** @param dateStart */
	public void setDateStart(Date dateStart) {
		this.dateStart = dateStart;
	}

	/** @param editionRequest */
	public void setEditionRequest(boolean editionRequest) {
		this.editionRequest = editionRequest;
	}

	/** @param quantity */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	/** @param stopped */
	public void setStopped(boolean stopped) {
		this.stopped = stopped;
	}

	/** @param subscription */
	public void setSubscription(SubscriptionVO subscription) {
		this.subscription = subscription;
	}

	/** @param subscriptionChanges */
	public void setSubscriptionChanges(List<SubscriptionChangeVO> subscriptionChanges) {
		this.subscriptionChanges = subscriptionChanges;
	}

	/** @param subscriptionDate */
	public void setSubscriptionDate(Date subscriptionDate) {
		this.subscriptionDate = subscriptionDate;
	}

	/** @param subscriptionPlan */
	public void setSubscriptionPlan(SubscriptionPlanVO subscriptionPlan) {
		this.subscriptionPlan = subscriptionPlan;
	}

	/** @param subscriptionRoadmaps */
	public void setSubscriptionRoadmaps(List<SubscriptionRoadmapVO> subscriptionRoadmaps) {
		this.subscriptionRoadmaps = subscriptionRoadmaps;
	}

	/** @param subscriptionService */
	public void setSubscriptionService(SubscriptionServiceVO subscriptionService) {
		this.subscriptionService = subscriptionService;
	}

}